package com.education.teach.mvp.ui.adapter;

import android.support.annotation.Nullable;
import android.text.Html;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.education.teach.R;
import com.education.teach.mvp.model.bean.CounselBean;

import java.util.List;

import dn.easy.common.commonutils.TimeUtil;

public class CounselAdapter extends BaseQuickAdapter<CounselBean.ResultBean.QueryListBean, BaseViewHolder> {
    public CounselAdapter(int layoutResId, @Nullable List<CounselBean.ResultBean.QueryListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CounselBean.ResultBean.QueryListBean item) {
        if ("0".equals(item.getState())){
            helper.setText(R.id.tv_title, Html.fromHtml(item.getContent()))
                    .setText(R.id.tv_state, item.getYhName())
                    .addOnClickListener(R.id.share)
                    .setText(R.id.tv_date, TimeUtil.formatData(TimeUtil.dateFormatYMDHMofChinese, item.getCreateDate()));
        }else{
            helper.setText(R.id.tv_title, Html.fromHtml(item.getContent()))
                    .setText(R.id.tv_state, item.getState())
                    .addOnClickListener(R.id.share)
                    .setText(R.id.tv_date, TimeUtil.formatData(TimeUtil.dateFormatYMDHMofChinese, item.getCreateDate()));
        }

    }
}
